#!/usr/bin/env bash

printhelp(){
    echo "Attribute:"
    echo "00=none  01=bold    04=underscore"
    echo "05=blink 07=reverse 08=concealed"
    echo "---------------------------------------"
    echo "Text:"
    echo "30=black 31=red     32=green 33=yellow"
    echo "34=blue  35=magenta 36=cyan  37=white"
    echo "---------------------------------------"
    echo "Background:"
    echo "40=black 41=red     42=green 43=yellow"
    echo "44=blue  45=magenta 46=cyan  47=white"
}

printcolor(){
    for attr in $@; do
    	for fg in `seq 30 37`; do
    		for bg in `seq 40 47`; do
    			echo -ne "\e[${attr};${fg};${bg}m""\\\e[${attr};${fg};${bg}m""\e[0m ";
    		done;
    	echo;
    	done;
    done;
    echo "";
}

if [ -n $1 ];then
    case $1 in
        -a)
            printcolor 0 1 4 5 7 8;
            ;;
        -h)
            printhelp;
            ;;
        *)
            printcolor 0 1;
            ;;
    esac
fi
